<template>
  <el-card header="站点top榜"
           :body-style="{ height: '688px', minWidth: '367px' }"
           style="overflow: auto">
    <div v-for="item in siteTOPList"
         :key="item.id"
         class="user-list-item">
      <el-avatar :size="46"
                 :src="item.logo?item.logo:require('/src/assets/微信图片_20231129095522.png')"
                 style="flex-shrink: 0" />
      <div class="user-list-item-body font-overflow">
        <div>{{ item.siteName }}</div>
        <ele-ellipsis type="placeholder"
                      size="sm">
          {{ item.siteDomainName }}
        </ele-ellipsis>
      </div>
      <div class="flex">
        <div class="user-list-item-body font-overflow">
          <div style="color: #333; font-weight: 700">{{
            item.orderTotal ? item.orderTotal : '0'
          }}</div>
          <ele-ellipsis type="placeholder"
                        size="sm"> 订单量 </ele-ellipsis>
        </div>
        <div class="user-list-item-body font-overflow">
          <div style="color: #333; font-weight: 700; font-size: 14px">{{
            item.userTotal ? item.userTotal : '0'
          }}</div>
          <ele-ellipsis type="placeholder"
                        size="sm"> 用户量 </ele-ellipsis>
        </div>
        <div class="user-list-item-body font-overflow">
          <div style="color: red; font-weight: 700">{{
            item.disbursementsTotal ? item.disbursementsTotal : '0'
          }}</div>
          <ele-ellipsis type="placeholder"
                        size="sm"> 收益金额 </ele-ellipsis>
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
import { getSiteTOP } from '@/api/mainPlatform/index';

export default {
  components: {},

  data () {
    return {
      siteTOPList: null
    };
  },
  created () {
    this.queryList();
  },
  methods: {
    async queryList () {
      const res = await getSiteTOP();
      console.log(res);
      this.siteTOPList = res;
    }
  }
};
</script>
<style lang="less" scoped>
.user-list-item {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  transition: background-color 0.2s;
  cursor: pointer;
  justify-content: space-around;
  .user-list-item-body {
    flex: 1;
    padding-left: 12px;
    box-sizing: border-box;
    width: 68px;
  }

  & + .user-list-item {
    border-top: 1px solid hsla(0, 0%, 60%, 0.2);
  }

  &:hover {
    background: hsla(0, 0%, 60%, 0.08);
  }
}
</style>
